/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.rec.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "REC_COMPROMISO_PAGO")
@NamedQueries({@NamedQuery(name = "CompromisoPago.findAll", query = "SELECT c FROM CompromisoPago c"), @NamedQuery(name = "CompromisoPago.findByIdCompromisoPago", query = "SELECT c FROM CompromisoPago c WHERE c.idCompromisoPago = :idCompromisoPago")})
public class CompromisoPago implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_COMPROMISO_PAGO", nullable = false)
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Integer idCompromisoPago;
    @JoinColumns({@JoinColumn(name = "FID_REC_CARTERA", referencedColumnName = "ID_CARTERA"), @JoinColumn(name = "FID_REC_CREDITO", referencedColumnName = "ID_CREDITO")})
    @ManyToOne(fetch = FetchType.LAZY)
    private CreditoCartera creditoCartera;

    public CompromisoPago() {
    }

    public CompromisoPago(Integer idCompromisoPago) {
        this.idCompromisoPago = idCompromisoPago;
    }

    public Integer getIdCompromisoPago() {
        return idCompromisoPago;
    }

    public void setIdCompromisoPago(Integer idCompromisoPago) {
        this.idCompromisoPago = idCompromisoPago;
    }

    public CreditoCartera getCreditoCartera() {
        return creditoCartera;
    }

    public void setCreditoCartera(CreditoCartera creditoCartera) {
        this.creditoCartera = creditoCartera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCompromisoPago != null ? idCompromisoPago.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CompromisoPago)) {
            return false;
        }
        CompromisoPago other = (CompromisoPago) object;
        if ((this.idCompromisoPago == null && other.idCompromisoPago != null) || (this.idCompromisoPago != null && !this.idCompromisoPago.equals(other.idCompromisoPago))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.rec.be.CompromisoPago[idCompromisoPago=" + idCompromisoPago + "]";
    }

}
